/* @(#)GSOrderCancelSubmitAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-3-16
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;

import system.LoginContext;

import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.business.GSOrderProcessor;
import com.hitrust.gs.business.GSUniteGwProcessor;
import com.hitrust.gs.dao.GSOrderDeptInfoDAO;
import com.hitrust.gs.form.GSOrderCancelSubmitForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

/**
 * 执行取消订单操作
 */
public class GSOrderCancelSubmitAction extends GSBaseAction {

    /* (non-Javadoc)
     * @see com.hitrust.gs.service.GSBaseAction#execute(com.hitrust.gs.service.GSBaseForm)
     */
    public String execute(GSBaseForm aForm) throws Exception {
        GSOrderCancelSubmitForm tForm = (GSOrderCancelSubmitForm)aForm;
        LoginContext context = (LoginContext)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String buf = df.format(new java.util.Date(System.currentTimeMillis()));
        String[] tOrderIds = tForm.getOrderIds();
        String taOrderDetailStatus = GSBaseConstants.ORDER_CANCEL;
        GSOrderProcessor.modifyCancelOrderTask(taOrderDetailStatus,tOrderIds,context.getLoginUserId(),buf);
      
        GSUniteGwProcessor unitePro=new GSUniteGwProcessor();
        ArrayList wareList=unitePro.getWareHouseLevelName(context.getLoginWarehouseCode(), context.getLoginWarehouseCode());
        aForm.getRequest().setAttribute("orderdept",wareList);
        
        aForm.getRequest().setAttribute("orderId",tForm.getOrderId());
        aForm.getRequest().setAttribute("orderStatus",tForm.getOrderStatus());
        aForm.getRequest().setAttribute("orderDeptId",tForm.getOrderDeptId());
        aForm.getRequest().setAttribute("deliverGoodsAddrId",tForm.getDeliverGoodsAddrId());
        aForm.getRequest().setAttribute("concentricityId",tForm.getConcentricityId());
        aForm.getRequest().setAttribute("manufInfo",tForm.getManufInfo());
        aForm.getRequest().setAttribute("orderCreateDateStr",tForm.getOrderCreateDateStr());
        aForm.getRequest().setAttribute("orderCreateDateEnd",tForm.getOrderCreateDateEnd());
        
        aForm.getRequest().setAttribute("requery","true");
        aForm.getRequest().setAttribute("message","所选申购单明细状态设置为'已取消'！");
        
       
        return GSBaseConstants.FORWARD_SUCCESS;
    }
  
}
